import datetime
from applications.extensions import db


class YeManyRelationship(db.Model):
    __tablename__ = 'ye_many_relationship'
    __table_args__ = ({'comment': '通用多对多关系表 '})  # 添加表注释
    id = db.Column(db.Integer, autoincrement=True, primary_key=True, comment="表id")
    mian_id = db.Column(db.Integer, comment="主表id")
    second_id = db.Column(db.Integer, comment="次表id")
    sort = db.Column(db.Integer, comment="排序")
    type = db.Column(db.String(20), comment='''类型 mian-group:second-group  : 菜单组-> 项目组的关联;
                                                类型 second-group:operation-detection  : 项目分组 -> 检测标志表 的关联;
                                            '''   )
    create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
    update_time = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')